import { http } from "@/utils/http";

/**
 * 获取所有映射列
 */
export const getAllColumnMap = (params?: {
  standardId?: string;
  keyword?: string;
  onlyEnabled?: boolean | string;
  page?: number;
  size?: number;
}) => {
  return http.request<any>("get", "/api/admin/column-mappings", { params });
};

/**
 * 创建映射列
 */
export const createColumnMap = (data: {
  priority?: string | number;
  originalName?: string;
  enabled?: boolean;
}) => {
  return http.request<any>("post", "/api/admin/column-mappings", {
    data,
    headers: { "Content-Type": "application/x-www-form-urlencoded" }
  });
};
/**
 * 更新映射列
 */
export const updateColumnMap = (data: {
  id?: number | string;
  priority?: string | number;
  originalName?: string;
  enabled?: boolean;
}) => {
  return http.request<any>("put", `/api/admin/column-mappings/${data.id}`, {
    data,
    headers: { "Content-Type": "application/x-www-form-urlencoded" }
  });
};

/**
 * 删除映射列
 */
export const deleteColumnwMap = (id: number) => {
  return http.request<any>("delete", `/api/admin/column-mappings/${id}`);
};
